Tcl Source Code

Check-in [98e788fbcd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More accurate documentation
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tip-711
Files: files | file ages | folders
SHA3-256: 98e788fbcdace2901b6eb55c4f63a47b44a9a114ee98ae7c4e756cae9940a0f6
User & Date: jan.nijtmans 2025-02-12 08:01:16.776
Context
2025-02-19
08:37
Rebase to 9.1 Closed-Leaf check-in: f6caedaeab user: jan.nijtmans tags: tip-711
2025-02-12
08:01
More accurate documentation check-in: 98e788fbcd user: jan.nijtmans tags: tip-711
2025-02-07
13:34
Add some testcases check-in: aa885b5745 user: jan.nijtmans tags: tip-711
Changes
Unified Diff Ignore Whitespace Patch
Changes to doc/StringObj.3.
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
white space, then that value is ignored entirely. This white-space
removal was added to make the output of the \fBconcat\fR command
cleaner-looking. \fBTcl_ConcatObj\fR returns a pointer to a
newly-created value whose ref count is zero.
.PP
The \fBTcl_IsEmpty\fR function returns 1 if \fIobjPtr\fR is the empty
string, 0 otherwise.
It doesn't generate the string representation (unless the
type is unknown), so it can safely be called on lists with
billions of elements, or any other data structure for which
it is impossible or expensive to construct the string representation.
.SH "REFERENCE COUNT MANAGEMENT"
.PP
\fBTcl_NewStringObj\fR, \fBTcl_NewUnicodeObj\fR, \fBTcl_Format\fR,
\fBTcl_ObjPrintf\fR, and \fBTcl_ConcatObj\fR always return a zero-reference
object, much like \fBTcl_NewObj\fR.







|
|







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
white space, then that value is ignored entirely. This white-space
removal was added to make the output of the \fBconcat\fR command
cleaner-looking. \fBTcl_ConcatObj\fR returns a pointer to a
newly-created value whose ref count is zero.
.PP
The \fBTcl_IsEmpty\fR function returns 1 if \fIobjPtr\fR is the empty
string, 0 otherwise.
It doesn't generate the string representation (unless there
is no other way to do it), so it can safely be called on lists with
billions of elements, or any other data structure for which
it is impossible or expensive to construct the string representation.
.SH "REFERENCE COUNT MANAGEMENT"
.PP
\fBTcl_NewStringObj\fR, \fBTcl_NewUnicodeObj\fR, \fBTcl_Format\fR,
\fBTcl_ObjPrintf\fR, and \fBTcl_ConcatObj\fR always return a zero-reference
object, much like \fBTcl_NewObj\fR.
Changes to generic/tclStringObj.c.
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376


4377
4378
4379
4380
4381
4382
4383
4384
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_IsEmpty --
 *
 *	Check whether the obj is empty.
 *
 * Results:
 *	-1 if the obj is NULL
 *	 1 if the obj is ""
 *   0 otherwise
 *
 * Side effects:


 *	String representation is generated if the obj has no lengthProc
 *
 *----------------------------------------------------------------------
 */

int
Tcl_IsEmpty(
    Tcl_Obj *objPtr)







|


<




>
>
|







4362
4363
4364
4365
4366
4367
4368
4369
4370
4371

4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_IsEmpty --
 *
 *	Check whether the obj is the empty string.
 *
 * Results:

 *	 1 if the obj is ""
 *   0 otherwise
 *
 * Side effects:
 *	If there is no other way to determine whethere the string
 *	representation is the empty string, the string representation
 *	is generated.
 *
 *----------------------------------------------------------------------
 */

int
Tcl_IsEmpty(
    Tcl_Obj *objPtr)